﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace InnovTech.Util.IO
{
    public static class StreamUtil
    {
        //intermediate operation, dont close and dispose both Stream instances.
        public static long Reset(Stream stream)
        {
            long currentPos = -1;
            if (stream.CanSeek)
            {
                currentPos = stream.Position;
                stream.Position = 0;
            }
            return currentPos;
        }

        public static void Seek(Stream stream, long pos)
        {
            if (stream.CanSeek)
                stream.Position = pos;
        }
    }
}
